<template>
  <div style="padding: 20px">
    <el-card>
      <!-- 头部 -->
      <el-row
        ><span style="font-size: 12px; color: red"
          >说明：目前支持学科和关键字条件筛选</span
        >
        <div style="margin-left: 1170px">
          <el-button
            size="small"
            icon="el-icon-edit"
            type="success"
            @click="$router.push('/questions/new/1')"
            >新增试题</el-button
          >
        </div>
      </el-row>
      <!-- 头部 -->
      <!-- 头部表单 -->
      <el-row :gutter="20" style="margin-top: 20px">
        <el-col :span="6"
          ><div class="grid-content bg-purple">
            <span>学科</span>
            <el-select
              style="margin-left: 10px"
              v-model="value"
              placeholder="请选择"
            >
              <el-option
                v-for="item in options"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              >
              </el-option>
            </el-select></div
        ></el-col>
        <el-col :span="6"
          ><div class="grid-content bg-purple">
            <span>二级目录</span>
            <el-select
              style="margin-left: 10px"
              v-model="value"
              placeholder="请选择"
            >
              <el-option
                v-for="item in secondTag"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              >
              </el-option>
            </el-select></div
        ></el-col>
        <el-col :span="6"
          ><div class="grid-content bg-purple">
            <span>标签</span>
            <el-select
              style="margin-left: 10px"
              v-model="value"
              placeholder="请选择"
            >
              <el-option
                v-for="item in tag"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              >
              </el-option>
            </el-select></div
        ></el-col>
        <el-col :span="5"
          ><div class="grid-content bg-purple">
            <span style="margin-top: 10px">关键词</span
            ><el-input
              placeholder="根据题干搜索"
              style="width: 200px"
            ></el-input></div
        ></el-col>
      </el-row>
      <!-- 2 -->
      <el-row :gutter="20" style="margin-top: 20px">
        <el-col :span="6"
          ><div class="grid-content bg-purple">
            <span>学科</span>
            <el-select
              style="margin-left: 10px"
              v-model="inputValue.subjectID"
              placeholder="请选择"
            >
              <el-option
                v-for="item in options"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              >
              </el-option>
            </el-select></div
        ></el-col>
        <el-col :span="6"
          ><div class="grid-content bg-purple">
            <span>二级目录</span>
            <el-select
              style="margin-left: 10px"
              v-model="inputValue.catalogID"
              placeholder="请选择"
            >
              <el-option
                v-for="item in options"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              >
              </el-option>
            </el-select></div
        ></el-col>
        <el-col :span="6"
          ><div class="grid-content bg-purple">
            <span>标签</span>
            <el-select
              style="margin-left: 10px"
              v-model="inputValue.tags"
              placeholder="请选择"
            >
              <el-option
                v-for="item in options"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              >
              </el-option>
            </el-select></div
        ></el-col>
        <el-col :span="6"
          ><div class="grid-content bg-purple">
            <span>学科</span>
            <el-select
              style="margin-left: 10px"
              v-model="inputValue.difficulty"
              placeholder="请选择"
            >
              <el-option
                v-for="item in options"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              >
              </el-option>
            </el-select></div
        ></el-col>
      </el-row>
      <!-- 3 -->
      <el-row :gutter="20" style="margin-top: 20px">
        <el-col :span="6"
          ><div class="grid-content bg-purple">
            <span>学科</span>
            <el-select
              style="margin-left: 10px"
              v-model="inputValue.difficulty"
              placeholder="请选择"
            >
              <el-option
                v-for="item in options"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              >
              </el-option>
            </el-select></div
        ></el-col>
        <el-col :span="6"
          ><div class="grid-content bg-purple">
            <span>二级目录</span>
            <el-select
              style="margin-left: 10px"
              v-model="inputValue.difficulty"
              placeholder="请选择"
            >
              <el-option
                v-for="item in options"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              >
              </el-option>
            </el-select></div
        ></el-col>
        <el-col :span="6"
          ><div class="grid-content bg-purple">
            <span>标签</span>
            <el-select
              style="margin-left: 10px; width: 100px"
              v-model="inputValue.difficulty"
              placeholder="请选择"
            >
              <el-option
                v-for="item in options"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              >
              </el-option>
            </el-select>
            <el-select
              style="margin-left: 10px; width: 100px"
              v-model="inputValue.difficulty"
              placeholder="请选择"
            >
              <el-option
                v-for="item in options"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              >
              </el-option>
            </el-select></div
        ></el-col>
        <el-col :span="5"
          ><div style="margin-left: 95px" class="grid-content bg-purple">
            <el-button>清除</el-button>
            <el-button type="primary">搜索</el-button>
          </div></el-col
        >
      </el-row>
      <!-- Tabs 标签页 -->
      <el-tabs
        style="margin-top: 18px"
        v-model="activeName"
        type="card"
        @tab-click="handleClick"
      >
        <el-tab-pane label="全部" name="first">
          <!-- 头部表单 -->
          <!-- alert -->
          <el-alert
            style="margin-top: 0px"
            type="info"
            :closable="false"
            show-icon
          >
            共{{ counts }}条记录
          </el-alert>
          <!-- alert -->
          <!-- 表格 -->
          <el-table
            :data="items"
            :header-cell-style="{ background: '#F3F4F7', color: '#555' }"
            style="width: 100%; margin-top: 20px"
          >
            <el-table-column prop="number" label="试题编号" width="120">
            </el-table-column>
            <el-table-column prop="subject" label="学科" width="120">
            </el-table-column>
            <el-table-column width="120" prop="catalog" label="目录">
            </el-table-column>
            <el-table-column width="120" prop="selectType" label="题型">
            </el-table-column>
            <el-table-column width="280" prop="question" label="题干">
            </el-table-column>
            <el-table-column width="180" prop="addDate" label="录入时间">
              <template #default="{ row }">
                <span>{{ row.addDate | dateformat }}</span>
              </template>
            </el-table-column>
            <el-table-column width="80" prop="difficultyType" label="难度">
            </el-table-column>
            <el-table-column width="120" prop="creator" label="录入人">
            </el-table-column>
            <el-table-column width="120" prop="checkState" label="审核状态">
            </el-table-column>
            <el-table-column width="150" prop="chkRemarks" label="审核意见">
            </el-table-column>
            <el-table-column width="120" prop="chkUser" label="审核人">
            </el-table-column>
            <el-table-column width="150" prop="PublishState" label="发布状态">
            </el-table-column>
            <el-table-column width="200" fixed="right" label="操作">
              <template #default="{ row }">
                <el-button
                  style="font-size: 12px"
                  type="text"
                  @click="Look(row)"
                  >预览</el-button
                >
                <el-button
                  :disabled="row.checkState !== '待审核' ? true : false"
                  style="font-size: 12px"
                  type="text"
                  @click="clickState(row)"
                  >审核</el-button
                >
                <el-button
                  :disabled="row.PublishState === '已发布' ? true : false"
                  style="font-size: 12px"
                  type="text"
                  @click="goChange(row)"
                  >修改</el-button
                >
                <el-button style="font-size: 12px" type="text">
                  <template>
                    <span @click="open(row)" v-if="row.publishState !== 1"
                      >上架</span
                    >
                    <span @click="open1(row)" v-else>下架</span>
                  </template>
                </el-button>
                <el-button
                  :disabled="row.PublishState === '已发布' ? true : false"
                  style="font-size: 12px"
                  type="text"
                  @click="deleteList(row)"
                  >删除</el-button
                >
              </template>
            </el-table-column>
          </el-table>
          <!-- 表格 -->

          <el-pagination
            background
            style="margin-left: 800px; margin-top: 20px"
            @current-change="handleCurrentChange"
            @size-change="sizeChange"
            :page-sizes="[5, 10, 20, 50]"
            :page-size="data.pagesize"
            layout=" prev, pager, next,sizes ,jumper"
            :total="counts"
          >
          </el-pagination>
        </el-tab-pane>
        <el-tab-pane label="待审核" name="second">
          <el-alert
            style="margin-top: 0px"
            type="info"
            :closable="false"
            show-icon
          >
            共{{ counts }}条记录
          </el-alert>
          <!-- alert -->
          <!-- 表格 -->
          <el-table
            :data="items"
            :header-cell-style="{ background: '#F3F4F7', color: '#555' }"
            style="width: 100%; margin-top: 20px"
          >
            <el-table-column prop="number" label="试题编号" width="120">
            </el-table-column>
            <el-table-column prop="subject" label="学科" width="120">
            </el-table-column>
            <el-table-column width="120" prop="catalog" label="目录">
            </el-table-column>
            <el-table-column width="120" prop="selectType" label="题型">
            </el-table-column>
            <el-table-column width="280" prop="question" label="题干">
            </el-table-column>
            <el-table-column width="180" prop="addDate" label="录入时间">
              <template #default="{ row }">
                <span>{{ row.addDate | dateformat }}</span>
              </template>
            </el-table-column>
            <el-table-column width="80" prop="difficultyType" label="难度">
            </el-table-column>
            <el-table-column width="120" prop="creator" label="录入人">
            </el-table-column>
            <el-table-column width="120" prop="checkState" label="审核状态">
            </el-table-column>
            <el-table-column width="150" prop="chkRemarks" label="审核意见">
            </el-table-column>
            <el-table-column width="120" prop="chkUser" label="审核人">
            </el-table-column>
            <el-table-column width="150" prop="PublishState" label="发布状态">
            </el-table-column>
            <el-table-column width="200" fixed="right" label="操作">
              <template #default="{ row }">
                <el-button
                  style="font-size: 12px"
                  type="text"
                  @click="Look(row)"
                  >预览</el-button
                >
                <el-button
                  :disabled="row.checkState !== '待审核' ? true : false"
                  style="font-size: 12px"
                  type="text"
                  @click="clickState(row)"
                  >审核</el-button
                >
                <el-button
                  :disabled="row.PublishState === '已发布' ? true : false"
                  style="font-size: 12px"
                  type="text"
                  @click="goChange(row)"
                  >修改</el-button
                >
                <el-button style="font-size: 12px" type="text">
                  <template>
                    <span @click="open(row)" v-if="row.publishState !== 1"
                      >上架</span
                    >
                    <span @click="open1(row)" v-else>下架</span>
                  </template>
                </el-button>
                <el-button
                  :disabled="row.PublishState === '已发布' ? true : false"
                  style="font-size: 12px"
                  type="text"
                  @click="deleteList(row)"
                  >删除</el-button
                >
              </template>
            </el-table-column>
          </el-table>
          <!-- 表格 -->

          <el-pagination
            background
            style="margin-left: 800px; margin-top: 20px"
            @current-change="handleCurrentChange"
            @size-change="sizeChange"
            :page-sizes="[5, 10, 20, 50]"
            :page-size="data.pagesize"
            layout=" prev, pager, next,sizes ,jumper"
            :total="counts"
          >
          </el-pagination>
        </el-tab-pane>
        <el-tab-pane label="已审核" name="third">
          <el-alert
            style="margin-top: 0px"
            type="info"
            :closable="false"
            show-icon
          >
            共{{ counts }}条记录
          </el-alert>
          <!-- alert -->
          <!-- 表格 -->
          <el-table
            :data="items"
            :header-cell-style="{ background: '#F3F4F7', color: '#555' }"
            style="width: 100%; margin-top: 20px"
          >
            <el-table-column prop="number" label="试题编号" width="120">
            </el-table-column>
            <el-table-column prop="subject" label="学科" width="120">
            </el-table-column>
            <el-table-column width="120" prop="catalog" label="目录">
            </el-table-column>
            <el-table-column width="120" prop="selectType" label="题型">
            </el-table-column>
            <el-table-column width="280" prop="question" label="题干">
            </el-table-column>
            <el-table-column width="180" prop="addDate" label="录入时间">
              <template #default="{ row }">
                <span>{{ row.addDate | dateformat }}</span>
              </template>
            </el-table-column>
            <el-table-column width="80" prop="difficultyType" label="难度">
            </el-table-column>
            <el-table-column width="120" prop="creator" label="录入人">
            </el-table-column>
            <el-table-column width="120" prop="checkState" label="审核状态">
            </el-table-column>
            <el-table-column width="150" prop="chkRemarks" label="审核意见">
            </el-table-column>
            <el-table-column width="120" prop="chkUser" label="审核人">
            </el-table-column>
            <el-table-column width="150" prop="PublishState" label="发布状态">
            </el-table-column>
            <el-table-column width="200" fixed="right" label="操作">
              <template #default="{ row }">
                <el-button
                  style="font-size: 12px"
                  type="text"
                  @click="Look(row)"
                  >预览</el-button
                >
                <el-button
                  :disabled="row.checkState !== '待审核' ? true : false"
                  style="font-size: 12px"
                  type="text"
                  @click="clickState(row)"
                  >审核</el-button
                >
                <el-button
                  :disabled="row.PublishState === '已发布' ? true : false"
                  style="font-size: 12px"
                  type="text"
                  @click="goChange(row)"
                  >修改</el-button
                >
                <el-button style="font-size: 12px" type="text">
                  <template>
                    <span @click="open(row)" v-if="row.publishState !== 1"
                      >上架</span
                    >
                    <span @click="open1(row)" v-else>下架</span>
                  </template>
                </el-button>
                <el-button
                  :disabled="row.PublishState === '已发布' ? true : false"
                  style="font-size: 12px"
                  type="text"
                  @click="deleteList(row)"
                  >删除</el-button
                >
              </template>
            </el-table-column>
          </el-table>
          <!-- 表格 -->

          <el-pagination
            background
            style="margin-left: 800px; margin-top: 20px"
            @current-change="handleCurrentChange"
            @size-change="sizeChange"
            :page-sizes="[5, 10, 20, 50]"
            :page-size="data.pagesize"
            layout=" prev, pager, next,sizes ,jumper"
            :total="counts"
          >
          </el-pagination>
        </el-tab-pane>
        <el-tab-pane label="已拒绝" name="fourth">
          <el-alert
            style="margin-top: 0px"
            type="info"
            :closable="false"
            show-icon
          >
            共{{ counts }}条记录
          </el-alert>
          <!-- alert -->
          <!-- 表格 -->
          <el-table
            :data="items"
            :header-cell-style="{ background: '#F3F4F7', color: '#555' }"
            style="width: 100%; margin-top: 20px"
          >
            <el-table-column prop="number" label="试题编号" width="120">
            </el-table-column>
            <el-table-column prop="subject" label="学科" width="120">
            </el-table-column>
            <el-table-column width="120" prop="catalog" label="目录">
            </el-table-column>
            <el-table-column width="120" prop="selectType" label="题型">
            </el-table-column>
            <el-table-column width="280" prop="question" label="题干">
            </el-table-column>
            <el-table-column width="180" prop="addDate" label="录入时间">
              <template #default="{ row }">
                <span>{{ row.addDate | dateformat }}</span>
              </template>
            </el-table-column>
            <el-table-column width="80" prop="difficultyType" label="难度">
            </el-table-column>
            <el-table-column width="120" prop="creator" label="录入人">
            </el-table-column>
            <el-table-column width="120" prop="checkState" label="审核状态">
            </el-table-column>
            <el-table-column width="150" prop="chkRemarks" label="审核意见">
            </el-table-column>
            <el-table-column width="120" prop="chkUser" label="审核人">
            </el-table-column>
            <el-table-column width="150" prop="PublishState" label="发布状态">
            </el-table-column>
            <el-table-column width="200" fixed="right" label="操作">
              <template #default="{ row }">
                <el-button
                  style="font-size: 12px"
                  type="text"
                  @click="Look(row)"
                  >预览</el-button
                >
                <el-button
                  :disabled="row.checkState !== '待审核' ? true : false"
                  style="font-size: 12px"
                  type="text"
                  @click="clickState(row)"
                  >审核</el-button
                >
                <el-button
                  :disabled="row.PublishState === '已发布' ? true : false"
                  style="font-size: 12px"
                  type="text"
                  @click="goChange(row)"
                  >修改</el-button
                >
                <el-button style="font-size: 12px" type="text">
                  <template>
                    <span @click="open(row)" v-if="row.publishState !== 1"
                      >上架</span
                    >
                    <span @click="open1(row)" v-else>下架</span>
                  </template>
                </el-button>
                <el-button
                  :disabled="row.PublishState === '已发布' ? true : false"
                  style="font-size: 12px"
                  type="text"
                  @click="deleteList(row)"
                  >删除</el-button
                >
              </template>
            </el-table-column>
          </el-table>
          <!-- 表格 -->

          <el-pagination
            background
            style="margin-left: 800px; margin-top: 20px"
            @current-change="handleCurrentChange"
            @size-change="sizeChange"
            :page-sizes="[5, 10, 20, 50]"
            :page-size="data.pagesize"
            layout=" prev, pager, next,sizes ,jumper"
            :total="counts"
          >
          </el-pagination>
        </el-tab-pane>
      </el-tabs>
      <!-- Tabs 标签页 -->
    </el-card>
    <!-- 详情弹出框 -->
    <el-dialog title="题目预览" :visible.sync="dialogVisible" width="57%">
      <el-row :gutter="20">
        <el-col :span="6">【题型】：{{ rows.selectType }}</el-col>
        <el-col :span="6">【编号】：{{ rows.id }}</el-col>
        <el-col :span="6">【难度】：{{ rows.difficultyType }}</el-col>
        <el-col :span="6">【标签】：{{ rows.tags }}</el-col>
      </el-row>
      &nbsp;
      <el-row :gutter="20">
        <el-col :span="6">【学科】：{{ rows.subject }}</el-col>
        <el-col :span="6">【目录】：{{ rows.catalog }}</el-col>
        <el-col :span="6">【方向】：{{ rows.direction }}</el-col>
      </el-row>
      &nbsp;
      <hr />
      <el-row>
        <el-col>【题干】：</el-col>
      </el-row>
      <p style="color: blue">{{ rows.question }}</p>
      <el-row>
        <el-col
          >{{ rows.selectType }} 选项：（以下选中的选项为正确答案）</el-col
        >
      </el-row>
      <el-row style="margin-top: 10px">
        <el-radio></el-radio>
      </el-row>
      <el-row style="margin-top: 10px">
        <el-radio></el-radio>
      </el-row>
      <el-row style="margin-top: 10px">
        <el-radio></el-radio>
      </el-row>
      <el-row style="margin-top: 10px">
        <el-radio></el-radio>
      </el-row>
      <hr />
      &nbsp;
      <el-row>
        <el-col
          >【参考答案】：
          <el-button @click="qwer = true" type="danger" size="small"
            >视频答案预览</el-button
          ></el-col
        >
      </el-row>
      <video
        style="width: 400px; height: 300px"
        v-if="qwer"
        src=""
        controls="controls"
      ></video>
      &nbsp;
      <hr />
      &nbsp;
      <el-row>
        <el-col>【答案解析】:{{ rows.remarks }}</el-col>
      </el-row>
      &nbsp;
      <hr />
      &nbsp;
      <el-row>
        <el-col>【题目备注】:{{ rows.remarks }}</el-col>
      </el-row>
      <span slot="footer" class="dialog-footer">
        <el-button type="primary" @click="dialogVisible = false"
          >关闭</el-button
        >
      </span>
    </el-dialog>
    <!-- 审核弹出框 -->
    <el-dialog title="题目审核" :visible.sync="dialogVisible1" width="30%">
      <el-row>
        <el-col>
          <el-radio-group v-model="stateCheck.chkState">
            <el-radio :label="1">通过</el-radio>
            <el-radio :label="2">拒绝</el-radio>
          </el-radio-group>
        </el-col>
      </el-row>
      <el-input
        style="margin-top: 20px"
        v-model="stateCheck.chkRemarks"
        type="textarea"
        :rows="2"
        placeholder="请输入内容"
      ></el-input>
      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogVisible1 = false">取 消</el-button>
        <el-button type="primary" @click="stateCheckAxios">确 定</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
import {
  choice,
  choiceCheck,
  choicePublish,
  remove,
} from "@/api/hmmm/questions";
export default {
  data() {
    return {
      inputValue: {
        difficulty: null, // 难度
        questionType: null, // 试题类型
        tags: null, // 标签
        province: null, // 城市
        city: null,
        keyword: null, // 关键字
        remarks: null, // 题目备注
        shortName: null, // 企业简称
        direction: null, // 方向
        subjectID: null, // 学科
        creatorID: null, // 录入人
        catalogID: null, // 二级目录
        page: 1,
        pagesize: 5,
      },
      // 学科
      options: [
        {
          value: "选项1",
          label: "学科",
        },
        {
          value: "选项2",
          label: "双皮奶",
        },
        {
          value: "选项3",
          label: "蚵仔煎",
        },
        {
          value: "选项4",
          label: "龙须面",
        },
        {
          value: "选项5",
          label: "北京烤鸭",
        },
      ],
      // 二级目录
      secondTag: [
        {
          value: "选项1",
          label: "二级目录",
        },
        {
          value: "选项2",
          label: "双皮奶",
        },
        {
          value: "选项3",
          label: "蚵仔煎",
        },
        {
          value: "选项4",
          label: "龙须面",
        },
        {
          value: "选项5",
          label: "北京烤鸭",
        },
      ],
      // 标签
      tag: [
        {
          value: "选项1",
          label: "标签",
        },
        {
          value: "选项2",
          label: "双皮奶",
        },
        {
          value: "选项3",
          label: "蚵仔煎",
        },
        {
          value: "选项4",
          label: "龙须面",
        },
        {
          value: "选项5",
          label: "北京烤鸭",
        },
      ],
      value: "",
      // 获取全部列表
      data: {
        page: 1,
        pagesize: 5,
      },
      // 获取待审核列表
      data1: {
        page: 1,
        pagesize: 5,
        chkState: 0,
      },
      // 获取已审核列表
      data2: {
        page: 1,
        pagesize: 5,
        chkState: 1,
      },
      // 获取已拒绝列表
      data3: {
        page: 1,
        pagesize: 5,
        chkState: 2,
      },
      qwer: false,
      dialogVisible: false,
      items: [],
      counts: null,
      activeName: "first",
      qwerqwe: {},
      rows: {},
      dialogVisible1: false,
      stateCheck: {
        chkRemarks: null,
        chkState: 1,
        id: null,
      },
      // tabsName
      tabsName: null,
    };
  },
  methods: {
    async choiceList() {
      const res = await choice(this.data);
      console.log(res);
      const items1234 = res.data.items;
      items1234.forEach((item) => {
        if (item.questionType === "1") {
          item.selectType = "单选";
        } else if (item.questionType === "2") {
          item.selectType = "多选";
        } else {
          item.selectType = "简答";
        }
        if (item.difficulty === "1") {
          item.difficultyType = "简单";
        } else if (item.difficulty === "2") {
          item.difficultyType = "一般";
        } else {
          item.difficultyType = "困难";
        }
        if (item.chkState === 1) {
          item.checkState = "已审核";
        } else if (item.chkState === 2) {
          item.checkState = "已拒绝";
        } else {
          item.checkState = "待审核";
        }
        if (item.publishState === 0 && item.checkState === "已审核") {
          item.PublishState = "已下架";
        } else if (item.publishState === 1) {
          item.PublishState = "已发布";
        } else {
          item.PublishState = "待发布";
        }
      });
      this.items = items1234;
      this.counts = res.data.counts;
    },
    // 点击tabs切换 tab 被选中时触发
    async handleClick(asd) {
      this.tabsName = asd.label;
      if (asd.label === "待审核") {
        const res = await choice(this.data1);
        console.log(res);
        const items1234 = res.data.items;
        items1234.forEach((item) => {
          if (item.questionType === "1") {
            item.selectType = "单选";
          } else if (item.questionType === "2") {
            item.selectType = "多选";
          } else {
            item.selectType = "简答";
          }
          if (item.difficulty === "1") {
            item.difficultyType = "简单";
          } else if (item.difficulty === "2") {
            item.difficultyType = "一般";
          } else {
            item.difficultyType = "困难";
          }
          if (item.chkState === 1) {
            item.checkState = "已审核";
          } else if (item.chkState === 2) {
            item.checkState = "已拒绝";
          } else {
            item.checkState = "待审核";
          }
          if (item.publishState === 0 && item.checkState === "已审核") {
            item.PublishState = "已下架";
          } else if (item.publishState === 1) {
            item.PublishState = "已发布";
          } else {
            item.PublishState = "待发布";
          }
        });
        this.items = items1234;
        this.counts = res.data.counts;
      } else if (asd.label === "已审核") {
        const res = await choice(this.data2);
        console.log(res);
        const items1234 = res.data.items;
        items1234.forEach((item) => {
          if (item.questionType === "1") {
            item.selectType = "单选";
          } else if (item.questionType === "2") {
            item.selectType = "多选";
          } else {
            item.selectType = "简答";
          }
          if (item.difficulty === "1") {
            item.difficultyType = "简单";
          } else if (item.difficulty === "2") {
            item.difficultyType = "一般";
          } else {
            item.difficultyType = "困难";
          }
          if (item.chkState === 1) {
            item.checkState = "已审核";
          } else if (item.chkState === 2) {
            item.checkState = "已拒绝";
          } else {
            item.checkState = "待审核";
          }
          if (item.publishState === 0 && item.checkState === "已审核") {
            item.PublishState = "已下架";
          } else if (item.publishState === 1) {
            item.PublishState = "已发布";
          } else {
            item.PublishState = "待发布";
          }
        });
        this.items = items1234;
        this.counts = res.data.counts;
      } else if (asd.label === "已拒绝") {
        const res = await choice(this.data3);
        console.log(res);
        const items1234 = res.data.items;
        items1234.forEach((item) => {
          if (item.questionType === "1") {
            item.selectType = "单选";
          } else if (item.questionType === "2") {
            item.selectType = "多选";
          } else {
            item.selectType = "简答";
          }
          if (item.difficulty === "1") {
            item.difficultyType = "简单";
          } else if (item.difficulty === "2") {
            item.difficultyType = "一般";
          } else {
            item.difficultyType = "困难";
          }
          if (item.chkState === 1) {
            item.checkState = "已审核";
          } else if (item.chkState === 2) {
            item.checkState = "已拒绝";
          } else {
            item.checkState = "待审核";
          }
          if (item.publishState === 0 && item.checkState === "已审核") {
            item.PublishState = "已下架";
          } else if (item.publishState === 1) {
            item.PublishState = "已发布";
          } else {
            item.PublishState = "待发布";
          }
        });
        this.items = items1234;
        this.counts = res.data.counts;
      } else {
        this.choiceList();
      }
    },
    handleCurrentChange(current) {
      this.data.page = current;
      this.choiceList();
    },
    // 点击分页
    sizeChange(size) {
      this.data.pagesize = size;
      this.choiceList();
    },
    // 点击查看
    Look(row) {
      this.qwer = false;
      console.log(row);
      this.dialogVisible = true;
      this.rows = row;
    },
    // 点击审核
    clickState(row) {
      this.dialogVisible1 = true;
      this.stateCheck.id = row.id;
    },
    // 点击审核确定
    async stateCheckAxios() {
      await choiceCheck(this.stateCheck);
      this.choiceList();
    },
    // 上架
    async open(row) {
      await this.$confirm("您确认上架这道题目吗?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      });
      row.publishState = 1;
      await choicePublish(row);
      this.$message.success("上架成功");
      if (this.tabsName === "待审核") {
        const res = await choice(this.data1);
        console.log(res);
        const items1234 = res.data.items;
        items1234.forEach((item) => {
          if (item.questionType === "1") {
            item.selectType = "单选";
          } else if (item.questionType === "2") {
            item.selectType = "多选";
          } else {
            item.selectType = "简答";
          }
          if (item.difficulty === "1") {
            item.difficultyType = "简单";
          } else if (item.difficulty === "2") {
            item.difficultyType = "一般";
          } else {
            item.difficultyType = "困难";
          }
          if (item.chkState === 1) {
            item.checkState = "已审核";
          } else if (item.chkState === 2) {
            item.checkState = "已拒绝";
          } else {
            item.checkState = "待审核";
          }
          if (item.publishState === 0 && item.checkState === "已审核") {
            item.PublishState = "已下架";
          } else if (item.publishState === 1) {
            item.PublishState = "已发布";
          } else {
            item.PublishState = "待发布";
          }
        });
        this.items = items1234;
        this.counts = res.data.counts;
      } else if (this.tabsName === "已审核") {
        const res = await choice(this.data2);
        console.log(res);
        const items1234 = res.data.items;
        items1234.forEach((item) => {
          if (item.questionType === "1") {
            item.selectType = "单选";
          } else if (item.questionType === "2") {
            item.selectType = "多选";
          } else {
            item.selectType = "简答";
          }
          if (item.difficulty === "1") {
            item.difficultyType = "简单";
          } else if (item.difficulty === "2") {
            item.difficultyType = "一般";
          } else {
            item.difficultyType = "困难";
          }
          if (item.chkState === 1) {
            item.checkState = "已审核";
          } else if (item.chkState === 2) {
            item.checkState = "已拒绝";
          } else {
            item.checkState = "待审核";
          }
          if (item.publishState === 0 && item.checkState === "已审核") {
            item.PublishState = "已下架";
          } else if (item.publishState === 1) {
            item.PublishState = "已发布";
          } else {
            item.PublishState = "待发布";
          }
        });
        this.items = items1234;
        this.counts = res.data.counts;
      } else if (this.tabsName === "已拒绝") {
        const res = await choice(this.data3);
        console.log(res);
        const items1234 = res.data.items;
        items1234.forEach((item) => {
          if (item.questionType === "1") {
            item.selectType = "单选";
          } else if (item.questionType === "2") {
            item.selectType = "多选";
          } else {
            item.selectType = "简答";
          }
          if (item.difficulty === "1") {
            item.difficultyType = "简单";
          } else if (item.difficulty === "2") {
            item.difficultyType = "一般";
          } else {
            item.difficultyType = "困难";
          }
          if (item.chkState === 1) {
            item.checkState = "已审核";
          } else if (item.chkState === 2) {
            item.checkState = "已拒绝";
          } else {
            item.checkState = "待审核";
          }
          if (item.publishState === 0 && item.checkState === "已审核") {
            item.PublishState = "已下架";
          } else if (item.publishState === 1) {
            item.PublishState = "已发布";
          } else {
            item.PublishState = "待发布";
          }
        });
        this.items = items1234;
        this.counts = res.data.counts;
      } else {
        this.choiceList();
      }
    },
    // 下架
    async open1(row) {
      await this.$confirm("您确认下架这道题目吗?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      });
      row.publishState = 0;
      await choicePublish(row);
      this.$message.success("下架成功");
      if (this.tabsName === "待审核") {
        const res = await choice(this.data1);
        console.log(res);
        const items1234 = res.data.items;
        items1234.forEach((item) => {
          if (item.questionType === "1") {
            item.selectType = "单选";
          } else if (item.questionType === "2") {
            item.selectType = "多选";
          } else {
            item.selectType = "简答";
          }
          if (item.difficulty === "1") {
            item.difficultyType = "简单";
          } else if (item.difficulty === "2") {
            item.difficultyType = "一般";
          } else {
            item.difficultyType = "困难";
          }
          if (item.chkState === 1) {
            item.checkState = "已审核";
          } else if (item.chkState === 2) {
            item.checkState = "已拒绝";
          } else {
            item.checkState = "待审核";
          }
          if (item.publishState === 0 && item.checkState === "已审核") {
            item.PublishState = "已下架";
          } else if (item.publishState === 1) {
            item.PublishState = "已发布";
          } else {
            item.PublishState = "待发布";
          }
        });
        this.items = items1234;
        this.counts = res.data.counts;
      } else if (this.tabsName === "已审核") {
        const res = await choice(this.data2);
        console.log(res);
        const items1234 = res.data.items;
        items1234.forEach((item) => {
          if (item.questionType === "1") {
            item.selectType = "单选";
          } else if (item.questionType === "2") {
            item.selectType = "多选";
          } else {
            item.selectType = "简答";
          }
          if (item.difficulty === "1") {
            item.difficultyType = "简单";
          } else if (item.difficulty === "2") {
            item.difficultyType = "一般";
          } else {
            item.difficultyType = "困难";
          }
          if (item.chkState === 1) {
            item.checkState = "已审核";
          } else if (item.chkState === 2) {
            item.checkState = "已拒绝";
          } else {
            item.checkState = "待审核";
          }
          if (item.publishState === 0 && item.checkState === "已审核") {
            item.PublishState = "已下架";
          } else if (item.publishState === 1) {
            item.PublishState = "已发布";
          } else {
            item.PublishState = "待发布";
          }
        });
        this.items = items1234;
        this.counts = res.data.counts;
      } else if (this.tabsName === "已拒绝") {
        const res = await choice(this.data3);
        console.log(res);
        const items1234 = res.data.items;
        items1234.forEach((item) => {
          if (item.questionType === "1") {
            item.selectType = "单选";
          } else if (item.questionType === "2") {
            item.selectType = "多选";
          } else {
            item.selectType = "简答";
          }
          if (item.difficulty === "1") {
            item.difficultyType = "简单";
          } else if (item.difficulty === "2") {
            item.difficultyType = "一般";
          } else {
            item.difficultyType = "困难";
          }
          if (item.chkState === 1) {
            item.checkState = "已审核";
          } else if (item.chkState === 2) {
            item.checkState = "已拒绝";
          } else {
            item.checkState = "待审核";
          }
          if (item.publishState === 0 && item.checkState === "已审核") {
            item.PublishState = "已下架";
          } else if (item.publishState === 1) {
            item.PublishState = "已发布";
          } else {
            item.PublishState = "待发布";
          }
        });
        this.items = items1234;
        this.counts = res.data.counts;
      } else {
        this.choiceList();
      }
    },
    // 删除
    async deleteList(row) {
      await remove(row);
      this.$message.success("删除成功");
      this.choiceList();
    },
    goChange(scope) {
      console.log(scope.id);
      this.$router.push(`/questions/new/${scope.id}`);
    },
    // clickTabs2 (asd) {
    //   console.log(asd)
    // }
  },
  created() {
    this.choiceList();
  },
  mounted() {},
};
</script>

<style scoped lang="scss"></style>
